package com.lamber.framework.web;

import com.lamber.framework.response.ResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SuperController {
    @Autowired
    protected HttpServletRequest request;

    @Autowired
    protected HttpServletResponse response;

    public ResponseMessage ok(){
        return ResponseMessage.ok();
    }

    public ResponseMessage ok(Object data){
        return ResponseMessage.ok(data);
    }

    public ResponseMessage ok(Object pager, Object data){
        return ResponseMessage.ok(pager, data);
    }

    public static ResponseMessage error(Exception ex) {
        return ResponseMessage.error(ex);
    }

    public static ResponseMessage error(String message) {
        return ResponseMessage.error(message);
    }

    public static ResponseMessage error(int code, String message) {
        return ResponseMessage.error(code, message);
    }

}
